.class public Llt/noframe/gpsfarmguide/undo/Caretaker;
.super Ljava/lang/Object;
.source "Caretaker.java"


# instance fields
.field private savedStates:Ljava/util/LinkedList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/LinkedList<",
            "Llt/noframe/gpsfarmguide/undo/Memento;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>()V
    .locals 1

    .line 8
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 9
    new-instance v0, Ljava/util/LinkedList;

    invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V

    iput-object v0, p0, Llt/noframe/gpsfarmguide/undo/Caretaker;->savedStates:Ljava/util/LinkedList;

    return-void
.end method


# virtual methods
.method public add(Llt/noframe/gpsfarmguide/undo/Memento;)V
    .locals 1

    .line 12
    iget-object v0, p0, Llt/noframe/gpsfarmguide/undo/Caretaker;->savedStates:Ljava/util/LinkedList;

    invoke-virtual {v0, p1}, Ljava/util/LinkedList;->addLast(Ljava/lang/Object;)V

    return-void
.end method

.method public clear()V
    .locals 1

    .line 21
    new-instance v0, Ljava/util/LinkedList;

    invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V

    iput-object v0, p0, Llt/noframe/gpsfarmguide/undo/Caretaker;->savedStates:Ljava/util/LinkedList;

    return-void
.end method

.method public getFirstMemento()Llt/noframe/gpsfarmguide/undo/AbstractMemento;
    .locals 1

    .line 25
    iget-object v0, p0, Llt/noframe/gpsfarmguide/undo/Caretaker;->savedStates:Ljava/util/LinkedList;

    invoke-virtual {v0}, Ljava/util/LinkedList;->size()I

    move-result v0

    if-lez v0, :cond_0

    .line 26
    iget-object v0, p0, Llt/noframe/gpsfarmguide/undo/Caretaker;->savedStates:Ljava/util/LinkedList;

    invoke-virtual {v0}, Ljava/util/LinkedList;->pollFirst()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Llt/noframe/gpsfarmguide/undo/AbstractMemento;

    return-object v0

    .line 28
    :cond_0
    new-instance v0, Llt/noframe/gpsfarmguide/undo/NullMemento;

    invoke-direct {v0}, Llt/noframe/gpsfarmguide/undo/NullMemento;-><init>()V

    return-object v0
.end method

.method public getLastMemento()Llt/noframe/gpsfarmguide/undo/AbstractMemento;
    .locals 1

    .line 32
    iget-object v0, p0, Llt/noframe/gpsfarmguide/undo/Caretaker;->savedStates:Ljava/util/LinkedList;

    invoke-virtual {v0}, Ljava/util/LinkedList;->size()I

    move-result v0

    if-lez v0, :cond_0

    .line 33
    iget-object v0, p0, Llt/noframe/gpsfarmguide/undo/Caretaker;->savedStates:Ljava/util/LinkedList;

    invoke-virtual {v0}, Ljava/util/LinkedList;->pollLast()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Llt/noframe/gpsfarmguide/undo/AbstractMemento;

    return-object v0

    .line 35
    :cond_0
    new-instance v0, Llt/noframe/gpsfarmguide/undo/NullMemento;

    invoke-direct {v0}, Llt/noframe/gpsfarmguide/undo/NullMemento;-><init>()V

    return-object v0
.end method

.method public getSavedStatesCount()I
    .locals 2

    .line 16
    iget-object v0, p0, Llt/noframe/gpsfarmguide/undo/Caretaker;->savedStates:Ljava/util/LinkedList;

    invoke-virtual {v0}, Ljava/util/LinkedList;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v1, "tt"

    invoke-static {v1, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 17
    iget-object v0, p0, Llt/noframe/gpsfarmguide/undo/Caretaker;->savedStates:Ljava/util/LinkedList;

    invoke-virtual {v0}, Ljava/util/LinkedList;->size()I

    move-result v0

    return v0
.end method
